<?php
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class ShopController extends Controller{
    public function shop_show(){
        $info=DB::table('shop_vip')->get();
        return view("Shop/index",['info'=>$info]);
    }
    public function shop_vipusershow(){
        $info=DB::table("shop_vipuser")->get();
        return view("Shop/vipuser",['info'=>$info]);
    }
    public function shop_vipadd(){
        $info=DB::table('shop_vipuser')->where("uid",$_POST['uid'])->first();
        if($info){
            $time=$info->e_time;
            $e_t=strtotime($time);
            $p_t=strtotime($_POST['e_time'].date("H:i:s"));
            if($e_t<$p_t){
                $arr['e_time']=$_POST['e_time'].date(" H:i:s");
                $data=DB::table("shop_vipuser")->where("uid",$_POST['uid'])->update($arr);
                if($data){
                    return redirect("shop_vipusershow");
                }else{
                    echo "修改失败";
                }
            }
        }else{
                echo "没有此用户";
                return redirect("shop_vipusershow");
            }

        }
    }